package BLL.User;

import BIZ.statementofncomeBiz;
import javabean.statementOfIncome;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "billdetail", value = "/billdetail")
public class billdetail extends HttpServlet {
    private static final long serialVersionUID = 1L;

    public billdetail() {
        super();
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        HttpSession session = request.getSession();

        //从session获取用户退费，充值前余额
        String UserName = (String) session.getAttribute("UserName");

        statementofncomeBiz statementofncomeBiz = new statementofncomeBiz();
        long a1;
        String a11;

        //将单个用户的近五次账单记录给session
        List<statementOfIncome> aa = statementofncomeBiz.getuserbill(UserName);
        for (int i = 0; i < aa.size(); i++) {
            a11 = (aa.get(i).getMoney() + "");
            session.setAttribute("aa" + i, a11);
        }
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doGet(request, response);
    }

}
